//
//import java.util.Scanner;
//
//public class Main {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while(scanner.hasNextInt()) {
//            int n = scanner.nextInt();
//            int capacity = 0; //创建的连接数
//            int size = 0; //已使用的连接数
//            for(int i = 0; i<n; i++) {
//                char ch = scanner.next().charAt(0);
//                String s = scanner.next();
//                if(s.equals("connect")) {
//                    size++;
//                    if(size > capacity) {
//                        //扩容
//                        capacity++;
//                    }
//                }else {
//                    //断开连接
//                    size--;
//                }
//            }
//            System.out.println(capacity);
//        }
//    }
//}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            String[] strs = new String[n];
            for(int i = 0; i<n; i++) {
                strs[i] = scanner.next();
            }
            Arrays.sort(strs,(a,b)->b.length()-a.length());
            List<String> list = new ArrayList<>();
            list.add(strs[0]);
            for(int i =1; i<n; i++) {
                if(check(list,strs[i])) {
                    list.add(strs[i]);
                }
            }
            Collections.sort(list);
            for(String str:list) {
                System.out.println("mkdir -p " + str);
            }
            System.out.println();
        }
    }
    public static boolean check(List<String> list, String str) {
        int n = str.length();
        int k;
        for(k  = 0; k<list.size(); k++) {
            String s = list.get(k);
            String[] s1 = s.split("/");
            String[] s2 = str.split("/");
            int len1 = s1.length;
            int len2 = s2.length;
            int i = 0, j = 0;
            while(i<len1 && j<len2) {
                if(s1[i].equals(s2[j])) {
                    i++;
                    j++;
                }else {
                    break;
                }
            }
            if(j == len2) return false;
        }
        return true;
    }
}